import { SelectControlSchema } from 'amis/lib/renderers/Form/Select'
import serverSelectUtils, { ServerSelectUtilsProps } from '@/components/amis/ServerSelectUtils/serverSelectUtils'
import smsAdminApiConfig from '@/core/sms/generated/apiconfig/smsAdminApiConfig'

class SmsSupplierIdSelectUtils {
	getSchema = (parmas?: Partial<SelectControlSchema>): SelectControlSchema => {
		const mergeProps = Object.assign(
			{
				label: '短信供应商',
				name: 'smsSupplierId',
				labelField: 'title',
				searchField: 'title',
				valueField: 'id',
				detailApiConfig: smsAdminApiConfig.smsSupplier.get,
				searchApiConfig: smsAdminApiConfig.smsSupplier.search,
			} as ServerSelectUtilsProps,
			parmas,
		)
		return serverSelectUtils.getSchema(mergeProps)
	}
}

export default new SmsSupplierIdSelectUtils()
